<template>
  <div id="search">
    <span class="top" v-show="searchlist.length">电影/电视剧/综艺</span>
      <ul>
        <li v-for="s in three" :key="s.id">
            <hr>
            <div id="scroll">
                <div class="head-left">
                    <!-- 海报 -->
                    <van-row gutter="10" >
                        <van-col span="6"><img :src="s.img"></van-col>
                        <van-col span="14">
                            <h3>{{s.nm}}</h3>
                            <span>{{s.enm}}</span>
                            <span class="spantext">{{s.cat}}</span><br>
                            <span>{{s.rt}}</span>
                        </van-col>
                        <van-col span="4">
                            <h3 class="h-active">{{s.sc}}分</h3>
                            <van-button type="primary" class="van-button" color="red" text="想看"></van-button>
                        </van-col>
                    </van-row>
            </div>
            </div>
        </li>
    </ul>
    <div class="bottom" v-show="searchlist.length" @click="showMovie">
      <h3>查看全部{{searchlist.length}}电影</h3>
    </div>
  <!-- 影院 -->
  <span class="top" v-show="cinema.length">影院</span>
      <ul>
        <li v-for="c in cinema" :key="c.id">
            <hr>
            <div id="scroll">
                <div class="head-left">
                    <van-row gutter="10" >
                        <van-col span="14">
                            <h3>{{c.nm}}</h3>
                            <span>{{c.info.name}}</span>
                            <span class="spantext">{{c.info.address}}</span><br> 
                        </van-col>
                        <van-col span="4">
                            <h3 class="h-active">{{c.info.price}}元起</h3>
                        </van-col>
                    </van-row>
            </div>
            </div>
        </li>
    </ul>
    <div class="bottom" v-show="searchlist.length" @click="cinema">
      <h3>查看全部{{searchlist.length}}家电影院</h3>
    </div>
  </div>
    
  </div>
</template>

<script>
export default {
    name:'search',
    props:['searchlist','address'],
    data(){
        return {
          three:[],
          cinema:[]
        }
    },
    methods:{
      showMovie(){
        this.$router.push({name:'searchmovie',params:{list:this.searchlist}})
      },
      showcinema(){
        // this.$router.push({name:'searchmovie',params:{list:this.searchlist}})
      }
    },
    watch:{
      searchlist(){
        this.three = this.searchlist.slice(0,3)
      },
      address(){
        console.log('监视了')
        this.cinema = this.address.slice(0,3)
      }
    }
}
</script>

<style scoped>
*{
    padding: 0;
    margin: 0;
}
#scroll {
    width: 100%;
    height: 100%;
    overflow: auto;
}
#search img{
    width: 100%;
    height: 100px;
}
#search .head-left{
    margin: 15px 0;
    padding: 0 15px;
}
#search .spantext{
    display: inline-block;
    width: 40vw;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}
#search .h-active{
    color: orange;
    font-weight: 700;
    font-size: 22px;
}
#search .van-button{
    width: 60px;
    height: 30px;
    line-height: 30px;
    border-radius:5px;
}
#search .top{
  width: 100%;
  height: 20px;
  color: gray;
  font-weight: 700;
}
#search .bottom{
  width: 100%;
  height: 30px;
  color: red;
  text-align: center;
  border-top: 2px solid gray;
  border-bottom: 2px solid gray;
}

</style>